import { RequestData, POST } from '@/utils/request-data';

const requestData = Object.create(RequestData);

requestData.setBaseUrl('erp/dealer/product');

// 商品信息
export const productGatherPage = params => requestData.base('/page/gather', POST, params);
export const productPlatformPage = params => requestData.base('/page/platform', POST, params);
export const productList = () => requestData.base('/list', POST);
// export const productAdd = params => requestData.base('/add', POST, params)
export const productManualAdd = params => requestData.base('/add/manual', POST, params);
export const productTemplateAdd = params => requestData.base('/add/template', POST, params);

export const productEdit = params => requestData.base('/edit', POST, params);
export const productRead = id => requestData.base(`/read/${id}`, POST);
export const productSave = params => requestData.base('/save', POST, params);
export const productUp = params => requestData.base('/upProduct', POST, params);
export const productDown = params => requestData.base('/downProduct', POST, params);
export const bindDesign = params => requestData.base('/bind/design', POST, params);

// 商品模板
export const productTemplateCope = id => requestData.base(`/template/copy/${id}`, POST);
export const productTemplatePage = params => requestData.base('/template/page', POST, params);
export const productTemplateRead = id => requestData.base(`/template/read/${id}`, POST);
export const productTemplateCategory = params => requestData.base('/category/template/list', POST, params);
export const productTemplateGroup = params => requestData.base('/group/template/list', POST, params);

// 商品分类
export const productCategoryPage = params => requestData.base('/category/page', POST, params);
export const productCategoryList = params => requestData.base('/category/list', POST, params);
export const productCategoryAdd = params => requestData.base('/category/add', POST, params);
export const productCategoryDelete = ids => requestData.base('/category/delete', POST, ids);
export const productCategoryRead = id => requestData.base(`/category/read/${id}`, POST);
export const productCategoryEdit = params => requestData.base('/category/edit', POST, params);

// 商品分组
export const productGroupPage = params => requestData.base('/group/page', POST, params);
export const productGroupList = params => requestData.base('/group/list', POST, params);
export const productGroupAdd = params => requestData.base('/group/add', POST, params);
export const productGroupDelete = ids => requestData.base('/group/delete', POST, ids);
export const productGroupEdit = params => requestData.base('/group/edit', POST, params);
export const productGroupRead = id => requestData.base(`/group/read/${id}`, POST, id);

// 商品库存
export const productStockPage = params => requestData.base('/stock/page', POST, params);
export const productStockAdd = params => requestData.base('/stock/add', POST, params);
export const productStockDelete = ids => requestData.base('/stock/delete', POST, ids);
export const productStockEdit = params => requestData.base('/stock/edit', POST, params);

// 商品标签
export const productTagPage = params => requestData.base('/tag/page', POST, params);
export const productTagList = storeId => requestData.base(`/tag/list/${storeId}`, POST);
export const productTagAdd = params => requestData.base('/tag/add', POST, params);
export const productTagDelete = ids => requestData.base('/tag/delete', POST, ids);
export const productTagEdit = params => requestData.base('/tag/edit', POST, params);
export const productTagRead = id => requestData.base(`/tag/read/${id}`, POST);

// 商品规格信息
export const productVariantPage = params => requestData.base('/variant/page', POST, params);
export const productVariantList = params => requestData.base('/variant/list', POST, params);
export const productVariantAdd = params => requestData.base('/variant/add', POST, params);
export const productVariantRead = id => requestData.base(`/variant/read/${id}`, POST);
export const productVariantDeleteName = ids => requestData.base('/variant/delete/name', POST, ids);
export const productVariantDeleteVal = ids => requestData.base('/variant/delete/value', POST, ids);
export const productVariantEdit = params => requestData.base('/variant/edit', POST, params);
export const productVariantChild = id => requestData.base(`/variant/child/${id}`, POST);

// 商品图片列表
export const productImagesPage = params => requestData.base('/image/page', POST, params);
export const productImagesList = params => requestData.base('/image/list', POST, params);
export const productImagesDelete = id => requestData.base(`/image/delete/${id}`, POST);
export const productImagesRead = id => requestData.base(`/image/read/${id}`, POST);
export const productImagesAdd = params => requestData.base('/image/add', POST, params);
export const productImagesEdit = params => requestData.base('/image/edit', POST, params);
export const productImagesUpload = formData => requestData.base('/image/upload', POST, formData);

// 商品图片分类
export const imageCategoryPage = params => requestData.base('/image/category/page', POST, params);
export const imageCategoryList = id => requestData.base(`/image/category/list/${id}`, POST);
export const imageCategoryAdd = params => requestData.base('/image/category/add', POST, params);
export const imageCategoryDelete = id => requestData.base(`/image/category/delete/${id}`, POST);
export const imageCategoryEdit = params => requestData.base('/image/category/edit', POST, params);
export const imageCategoryRead = id => requestData.base(`/image/category/read/${id}`, POST);

// 商品收藏/采集
export const collectFavorite = ids => requestData.base('/collect/favorite', POST, ids);
export const collectPage = params => requestData.base('/collect/page', POST, params);
export const collectDelete = id => requestData.base(`/collect/delete/${id}`, POST);
export const gather = ids => requestData.base('/collect/gather', POST, ids);
export const claim = params => requestData.base('/collect/use', POST, params);
export const copy = params => requestData.base('/collect/copy', POST, params);

// 商品信息
export const productShopifyPage = params => requestData.base('/shopify/page', POST, params);
export const productShopifyAdd = params => requestData.base('/shopify/add', POST, params);
export const productShopifyEdit = params => requestData.base('/shopify/edit', POST, params);
export const productShopifyRead = id => requestData.base(`/shopify/read/${id}`, POST);
export const productShopifyDelete = ids => requestData.base('/shopify/delete', POST, ids);
export const productShopifyPublish = ids => requestData.base('/shopify/publish', POST, ids);
export const productShopifyUnpublish = ids => requestData.base('/shopify/unpublish', POST, ids);

export const productWoocPage = params => requestData.base('/woocommerce/page', POST, params);
export const productWoocAdd = params => requestData.base('/woocommerce/add', POST, params);
export const productWoocEdit = params => requestData.base('/woocommerce/edit', POST, params);
export const productWoocRead = id => requestData.base(`/woocommerce/read/${id}`, POST);
export const productWoocDelete = ids => requestData.base('/woocommerce/delete', POST, ids);
export const productWoocPublish = ids => requestData.base('/woocommerce/publish', POST, ids);
export const productWoocUnpublish = ids => requestData.base('/woocommerce/unpublish', POST, ids);

// 供应商
export const vendorList = params => requestData.base('/vendor/list', POST, params);
export const vendorAdd = params => requestData.base('/vendor/add', POST, params);
export const vendorDelete = id => requestData.base(`/vendor/delete/${id}`, POST);

// 商品采集
export const collectionPage = params => requestData.base('/collection/page', POST, params);
export const collection = params => requestData.base('/collection/collection', POST, params);
export const collectionDelete = params => requestData.base('/collection/delete', POST, params);
export const collectionClaim = params => requestData.base('/collection/claim', POST, params);
